package com.cloud.imgCloud.exception;

/**
 * 断言工具类
 */
public class ThrowUtils {
    public static void throwIf(boolean condition, ErrorCode errorCode) {
        throwIf(condition, errorCode.getCode(), errorCode.getMessage());
    }

    public static void throwIf(boolean condition, ErrorCode errorCode, String message) {
        throwIf(condition, errorCode.getCode(), message);
    }

    public static void throwIf(boolean condition, int code, String message) {
        if (condition) {
            throw new BusinessException(code, message);
        }
    }
}
